<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/hui/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/hui/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/hui/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/hui/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/hui/static/h-ui.admin/css/style.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/hui/lib/laypage/1.2/skin/laypage.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>大客户管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 大客户 <span class="c-gray en">&gt;</span> 大客户管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<form class="dataform" method="post">
	<div class="text-c">
		<button onclick="removeIframe()" class="btn btn-primary radius">关闭选项卡</button>
	</div>
	</form>
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
			<thead>
				<tr class="text-c">
					<th width="40">电话</th>
					<th width="50">昵称</th>
					<th width="90">创建时间</th>
					<th width="90">登陆时间</th>
					<th width="50">余额</th>
					<th width="50">操作</th>
				</tr>
			</thead>
			<tbody id="ordercontent" class="text-c">
				<c:forEach items="${selectZhBusinessUser}" var="BusinessUser">
				<tr>
					<td>${BusinessUser.phone }</td>
					<td>${BusinessUser.nickname }</td>
					<td><fmt:formatDate value="${BusinessUser.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
					<td><fmt:formatDate value="${BusinessUser.loginTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
					<td>${BusinessUser.totalAssets}</td>
					<td>
						<a onclick="to_recharge('充值中心','${base}/admin/businessToRecharge?userId=${BusinessUser.id}')" href="javascript:;" class="btn btn-xs btn-danger ui-tooltip">充值</a>
						<a onclick="to_recharge('充值记录','${base}/admin/sumRechargerRecord?id=${BusinessUser.id}')"  class="btn btn-xs btn-primary ui-tooltip">查看充值记录</a>
						<input type="button" class="btn btn-success btn-xs" value="查看详情" onclick="showDetail(${BusinessUser.id})"/>
						<input type="hidden" value="${BusinessUser.id}" id="id">
					</td>
				</tr>
				</c:forEach>
			</tbody>
		</table>
		<!-- <div style="width: 100%;height:15px;"></div>
		<div id="page1" class="pager"></div> -->
	</div>
</div>
<div id="detail" style="display:none">
	<table class="table table-striped table-bordered table-hover" data-search="true">
        <tr> 
            <td class="text-center"><b>电话</b></td>
            <td class="text-center"><b>昵称</b></td>
            <td class="text-center"><b>创建时间</b></td>
            <td class="text-center"><b>登录时间</b></td>
            <td class="text-center"><b>余额</b></td>
        </tr>
        <tr>
        	<td class="text-center" id="phone"></td>
        	<td class="text-center" id="nickname"></td>
        	<td class="text-center" id="createTime"></td>
        	<td class="text-center" id="loginTime"></td>
        	<td class="text-center" id="totalAssets"></td>
        </tr>
        <tr>
        	<td class="text-center"><b>接入端口token</b></td>
            <td class="text-center"><b>接入端口appkey</b></td>
            <td class="text-center"><b>接入端口appsecret</b></td>
            <td class="text-center"><b>接入端口phone</b></td>
            <td class="text-center"><b>接入端口url</b></td>
            <td class="text-center"><b>操作</b></td>
        </tr>
        <tr>
        	<td class="text-center" id="portToken" ></td>
        	<td class="text-center" id="portAppkey"></td>
        	<td class="text-center" id="portAppsecret"></td>
        	<td class="text-center" id="portPhone"></td>
        	<td class="text-center" id="portUrl"></td>
        	<td class="text-center" id="portUpdate"></td>
        </tr>
        <!-- <tr>
        	<td class="text-center"><b>接入端口url</b></td>
            <td class="text-center"><b></b></td>
            <td class="text-center"><b></b></td>
            <td class="text-center"><b></b></td>
            <td class="text-center"><b></b></td>
        </tr>
        <tr>
        	<td class="text-center" id="portUrl"></td>
        	<td class="text-center" id="">&nbsp;</td>
        	<td class="text-center" id="">&nbsp;</td>
        	<td class="text-center" id="">&nbsp;</td>
        	<td class="text-center" id="">&nbsp;</td>
        </tr> -->
	</table>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="${pageContext.request.contextPath}/static/hui/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath}/static/hui/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/hui/static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath}/static/hui/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="${pageContext.request.contextPath}/static/hui/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<!-- <script type="text/javascript" src="${pageContext.request.contextPath}/static/hui/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>  -->
<script type="text/javascript" src="${pageContext.request.contextPath}/static/hui/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/hui/receives.js"></script>
<script type="text/javascript">
/*充值、充值记录-弹框*/
function to_recharge(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
function showDetail(id){
	 //通过id获取 该卡段信息
		layer.open({
 			  type: 1,
 			  title: '卡段详情',
 			  shade: 0,
			  shadeClose: true,
 			  skin: 'layui-layer-rim', //加上边框
 			  area: ['1000px', '300px'], //宽高
 			  content: $('#detail')
 			});
		 $.ajax({
			url:"${pageContext.request.contextPath}/bussiness/BusinessAll",
	        type:'post',
	        dataType:'json',
	        data:{"id":id},
	        success:function(res){
      		//debugger;
      		$("#phone").html(res.data.phone);
          	$("#nickname").html(res.data.nickname);
          	$("#createTime").html(res.data.createTime);
          	$("#loginTime").html(res.data.loginTime);
          	$("#totalAssets").html(res.data.totalAssets);
          	
           $("#portToken").html("<input type='text' id='text_portToken' name='text_portToken' value='"+res.data.portToken+"' readOnly/>");
           $("#portAppkey").html("<input type='text' id='text_portAppkey' name='text_portAppkey' value='"+res.data.portAppkey+"' readOnly/>");
           $("#portAppsecret").html("<input type='text' id='text_portAppsecret' name='text_portAppsecret' value='"+res.data.portAppsecret+"' readOnly/>");
           $("#portUrl").html("<input type='text' id='text_portUrl' name='text_portUrl' value='"+res.data.portUrl+"' readOnly/>");
           $("#portPhone").html("<input type='text' id='text_portPhone' name='text_portPhone 'value='"+res.data.portPhone+"' readOnly/>");
           $("#portUpdate").html("<a href='javascript:toUpdate("+res.data.id+");'>编辑</a>&nbsp;<a href='javascript:portUpdate("+res.data.id+");'>修改</a>");
           
      		layer.open({
     			  type: 1,
     			  title: '订单详情',
     			  shade: 0,
				  shadeClose: true,
     			  skin: 'layui-layer-rim', //加上边框
     			  area: ['1000px', '300px'], //宽高
     			  content: $('#order')
     			});
	        }
		}); 
	}
/* 修改 */
function toUpdate(id){
	// 先读取接入数据，  修改接入数据
	$("#text_portToken").removeAttr("readonly");
	$("#text_portToken").css("border","1px green solid");
	$("#text_portAppkey").removeAttr("readonly");
	$("#text_portAppkey").css("border","1px green solid");
	$("#text_portAppsecret").removeAttr("readonly");
	$("#text_portAppsecret").css("border","1px green solid");
	$("#text_portUrl").removeAttr("readonly");
	$("#text_portUrl").css("border","1px green solid");
	$("#text_portPhone").removeAttr("readonly");
	$("#text_portPhone").css("border","1px green solid");
	
}
function portUpdate(id){
	// 先读取接入数据，  修改接入数据
	var  portToken = $("#text_portToken").val();
	var  portAppkey = $("#text_portAppkey").val();
	var  portAppsecret = $("#text_portAppsecret").val();
	var  portUrl = $("#text_portUrl").val();
	var  portPhone = $("#text_portPhone").val();
   $.ajax({
		url :"${base}/bussiness/portUpdate",
		type : 'post',
		dataType : 'json',
		data :{"id":id,"portToken":portToken,"portAppkey":portAppkey,
			"portAppsecret":portAppsecret,"portUrl":portUrl,"portPhone":portPhone},
		success : function(res) {
			layer.open({
				  title: '提示'
				  ,content: '修改成功,请刷新页面查看'
				});
			 $("#text_portToken").attr("readonly",true);
			 $("#text_portToken").css("border","0px black solid");
			 $("#text_portAppkey").attr("readonly",true);
			 $("#text_portAppkey").css("border","0px black solid");
			 $("#text_portAppsecret").attr("readonly",true);
			 $("#text_portAppsecret").css("border","0px black solid");
			 $("#text_portUrl").attr("readonly",true);
			 $("#text_portUrl").css("border","0px black solid");
			 $("#text_portPhone").attr("readonly",true);
			 $("#text_portPhone").css("border","0px black solid");
		}
	});
	
}
</script> 
</body>
</html>